<template>
    <div>
        Child
    </div>
</template>
<script>
import { onBeforeUnmount, onMounted, onUnmounted } from 'vue';

export default {
    setup() {

        let timerId
        onMounted(() => {
            timerId = setInterval(() => {
                console.log(666);
            }, 5000)
        })

        onBeforeUnmount(() => {
            console.log("onBeforeUnmount执行了");
        })

        onUnmounted(() => {
            console.log("onUnmounted执行了");
            clearInterval(timerId)
        })
    },
}
</script>